<?php 
session_start();

	include("../../conexion.php");
	
	require_once("../../includes/barramenu.php") ;
	require_once("../../includes/gridView.php")  ;
	require_once("../../includes/combo.php")  	  ;
	$oBarra = new BarraMenu() 				  ;
	$Grid1 = new GridView()					  ;
	$oCombo = new CmbList()  				  ;	
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Certificado Domiciliario</title>
<link href="../../includes/css/jquery-ui-notarios.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="../../tcal.css" />
<link href="../../includes/css/jquery-ui-notarios.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="../../includes/css/uniform.default.min.css" />
<link rel="stylesheet" type="text/css" href="../../tcal.css" />
<link rel="stylesheet" type="text/css" href="../includes/css/CertDomiVie.css" />

<script type="text/javascript" src="../../tcal.js"></script> 
<script type="text/javascript" src="../includes/Mantenimientos.js"></script> 
<script src="../../includes/jquery-1.8.3.js"></script>
<script src="../../includes/js/jquery-ui-notarios.js"></script>
<script src="../../includes/jquery.uniform.min.js"></script>
<script src="../../includes/maskedinput.js"></script>
<script type="text/javascript" src="../../tcal.js"></script> 
<script type="text/javascript" src="../includes/js/CertDomiVie.js"></script> 

<script type="text/javascript">

	function fImprimir()
	{
		var _num_crono = document.getElementById('num_certificado').value;
		if(_num_crono==''){alert('Debe guardar los datos primero');return;}
	
		var _usuario_imprime = '<?php echo $_SESSION["apepat_usu"].' '.$_SESSION["nom1_usu"]; ?>';
		var _nom_notario     = 'NOMBRE DEL NOTARIO';
	
		_data =
		{
			num_certificado : _num_crono,
			usuario_imprime : _usuario_imprime,
			nom_notario : _nom_notario
		}
	
		$.post("../../reportes_word/generador_certifi_domiciliario.php",_data,function(_respuesta){
						alert(_respuesta);
					});
	
	}

	function fVisualDocument()
	{
		var valid_numcrono = document.getElementById('num_certificado').value;
		if(valid_numcrono==''){alert('Debe guardar los datos primero');return;}
		var _num_crono = document.getElementById('muesnumcerti').value;
		
		var _usuario_imprime = '<?php echo $_SESSION["apepat_usu"].' '.$_SESSION["nom1_usu"]; ?>';
		var _nom_notario     = 'NOMBRE DEL NOTARIO';

		window.open("genera_domiciliario.php?num_crono="+_num_crono+"&usuario_imprime="+_usuario_imprime+"&nom_notario="+_nom_notario);				
	}
	
function nomtestigo(){
	
 valord=document.getElementById('nnom_testigo').value;
 textod=valord.replace(/&/g,"*");
 document.getElementById('nom_testigo').value=textod;
}

function domicilio(){
 valord=document.getElementById('ndomic_solic').value;
 textod=valord.replace(/&/g,"*");
 document.getElementById('domic_solic').value=textod;

}
function nombresolic(){
 valord=document.getElementById('nnombre_solic').value;
 textod=valord.replace(/&/g,"*");
 document.getElementById('nombre_solic').value=textod;

}
	

</script>
</head>

<body style="font-size:62.5%;">
<div id="carta_content">

<table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
  <tr><td>
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td width="23%">
     <?php
				$oBarra->Graba        = "1"               ;
				$oBarra->GrabaClick   = "fGraba();"       ;
				$oBarra->Impri        = "1"               ;
				$oBarra->ImpriClick   = "fImprimir();"    ;
				$oBarra->clase        = "css"      		  ; 
				$oBarra->widthtxt   = "20"				  ; 
				$oBarra->Show()  						  ; 
				?>
    </td>
	<td width="77%"><div id="verdocumen"><button title="visualizar" type="button" name="btnver"    id="btnver" value="visualizar" onclick="fVisualDocument();" ><img align="absmiddle" src="../../images/block.png" width="15" height="15" />Ver</button></div></td>
</tr>
</table>
  </td></tr>
  <tr>
    <td ><table  width="100%">
      <tr>
        <td colspan="6"><div id="muesguarda" title="Confirmacion" style="display:none">Desea guardar el Certificado..?</div><div id="confirmaGuarda"></div></td>
        </tr>
      <tr>
        <td width="13%"><span class="camposss">Nro certificado:</span></td>
        <td width="19%"><div id="resul_certi" style="width:100px;"><input name="num_certificado" type="text" id="num_certificado" style="text-transform:uppercase" size="15" readonly="readonly" placeholder="Autogenerado" /></div></td>
        <td width="11%"><span class="camposss">Fecha Ingreso:</span> </td>
        <td width="23%"><input name="fec_ingreso" type="text" id="fec_ingreso" style="text-transform:uppercase" size="15" value="<?php echo date("d/m/Y"); ?>"  class="tcal" /></td>
        <td width="14%"><span class="camposss"># Formulario:</span></td>
        <td width="20%"><input name="num_formu" type="text" id="num_formu" style="text-transform:uppercase" size="15" /></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td>
    <fieldset>
    <legend><strong><span class="camposss">SOLICITANTE</span></strong></legend>
    <table  width="100%">
        <tr>
          <td width="9%"><span class="camposss">Solicitante:</span></td>
          <td colspan="3"><input name="nnombre_solic" type="text" id="nnombre_solic" style="text-transform:uppercase" size="100" maxlength="400"  onKeyUp="nombresolic();"/>
          <input type="hidden" name="nombre_solic" style="text-transform:uppercase" id="nombre_solic" />
          </td>
          </tr>
        <tr>
          <td><span class="camposss">Identificado con:</span></td>
          <td width="25%" colspan="-1"><?php 
			$oCombo = new CmbList()  ;					 		
			$oCombo->dataSource = "SELECT tipodocumento.codtipdoc AS 'id', tipodocumento.destipdoc AS 'des'
FROM tipodocumento
ORDER BY tipodocumento.destipdoc ASC"; 
			$oCombo->value      = "id";
			$oCombo->text       = "des";
			$oCombo->size       = "200"; 
			$oCombo->name       = "tipdoc_solic";
			$oCombo->style      = "camposss"; 
			$oCombo->click      = "//selectAsunto(this.value);";   
			$oCombo->selected   = "01";
			$oCombo->Show();
			$oCombo->oDesCon(); 
?></td>
          <td width="10%" colspan="-1" align="right"><span class="camposss">Nro.</span></td>
          <td width="56%" colspan="-1"><input name="numdoc_solic" type="text" id="numdoc_solic" style="text-transform:uppercase" size="15" maxlength="20" placeholder="Num. Docum." /></td>
        </tr>
        <tr>
          <td><span class="camposss">Domicilio:</span></td>
          <td colspan="3"><input name="ndomic_solic" type="text" id="ndomic_solic" style="text-transform:uppercase" size="100" maxlength="2000"  placeholder="Direccion" onKeyUp="domicilio();"/>
                    <input type="hidden" name="domic_solic" style="text-transform:uppercase" id="domic_solic" />
          </td>
          </tr>
        <tr>
          <td><span class="camposss">Distrito:</span></td>
          <td colspan="3"><?php 
			$oCombo = new CmbList()  ;					 		
			$oCombo->dataSource = "SELECT ubigeo.coddis AS 'id', CONCAT(ubigeo.nomdis,'/', ubigeo.nomprov,'/',ubigeo.nomdpto)  AS 'descripcion' FROM ubigeo
ORDER BY ubigeo.nomdis ASC
"; 
			$oCombo->value      = "id";
			$oCombo->text       = "descripcion";
			$oCombo->size       = "150"; 
			$oCombo->name       = "distrito_solic";
			$oCombo->style      = "camposss"; 
			$oCombo->click      = "//selectzona(this.value);";   
			$oCombo->selected   =  "150101";
			$oCombo->Show();
			$oCombo->oDesCon(); 
?></td>
          </tr>
        <tr>
          <td><span class="camposss">Motivo:</span></td>
          <td colspan="3"><input name="motivo_solic" type="text" id="motivo_solic" style="text-transform:uppercase" size="100" maxlength="2000" /></td>
          </tr>
   <tr>

    <td height="30" align="right"><span class="camposss">Estado Civil :</span></td>
    <td height="30"><select name="idestcivil" id="idestcivil">
      <option value = "1" selected="selected"></option>
      <?php
	   	  $civil=mysql_query("SELECT * FROM tipoestacivil",$conn) or die(mysql_error());
		  while($rowcicil=mysql_fetch_array($civil)){
		  echo "<option value = ".$rowcicil["idestcivil"].">".nl2br($rowcicil["desestcivil"])."</option>";  
		  }
		?>
    </select></td>
  </tr>
  <tr>

    <td height="30" align="left"><span class="camposss">Sexo :</span></td>
    <td height="30"><select name="sexo" id="sexo">
      <option value = "" selected="selected">SELECCIONE SEXO</option>
      <option value="M">MASCULINO</option>
      <option value="F">FEMENINO</option>
    </select></td>
    <td height="30" align="right">&nbsp;</td>
    <td height="30">&nbsp;</td>
  </tr>
        </table>
    </fieldset>  
      </td>
    </tr>
  <tr>
    <td height="30"><fieldset>
      <legend><strong>CUERPO</strong></legend>
      <table  width="100%">
        <tr>
          <td width="9%" align="center"><button title="Borrar" type="button" name="borrar"    id="borrar" value="borrar" onclick="fborrar();" ><img src="../../images/eraser.png" width="25" height="25" align="absmiddle" /></br>&nbsp;&nbsp;Borrar&nbsp;&nbsp;</button></td>
          <td><label for="texto_cuerpo"></label>
            <textarea style="text-transform:uppercase;" name="texto_cuerpo" id="texto_cuerpo" cols="95" rows="5"></textarea></td>
        </tr>
        <tr>
         <td colspan="6"><span class="camposss">Testigo a ruego:
              <input name="nnom_testigo" type="text" id="nnom_testigo" style="text-transform:uppercase" size="80" maxlength="400" onKeyUp="nomtestigo();"/>
              <input type="hidden" name="nom_testigo" style="text-transform:uppercase" id="nom_testigo" />
          </span></td>
        </tr>
        
        <tr>
         <td><span class="camposss">Identificado con:</span></td>
          <td><?php 
			$oCombo = new CmbList()  ;					 		
			$oCombo->dataSource = "SELECT tipodocumento.codtipdoc AS 'id', tipodocumento.destipdoc AS 'des'
FROM tipodocumento
ORDER BY tipodocumento.destipdoc ASC"; 
			$oCombo->value      = "id";
			$oCombo->text       = "des";
			$oCombo->size       = "200"; 
			$oCombo->name       = "tdoc_testigo";
			$oCombo->style      = "camposss"; 
			$oCombo->click      = "//selectAsunto(this.value);";   
			$oCombo->selected   =  "01";
			$oCombo->Show();
			$oCombo->oDesCon(); 
?></td>
          <td align="right"><span class="camposss">Nro.</span></td>
          <td><input name="ndocu_testigodom" type="text" id="ndocu_testigodom" style="text-transform:uppercase" size="15" maxlength="20" placeholder="N. documento" /></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2"><input name="justifi_cuerpo" type="hidden" id="justifi_cuerpo" /></td>
        </tr>
        <tr>
          <td colspan="2"><input name="id_domiciliario" type="hidden" id="id_domiciliario" /></td>
          </tr>
        </table>
    </fieldset></td>
  </tr>
</table>
</div>
</body>
</html>